﻿/*************************************************
Required:   
            1. jquery.maskedInput.js
**************************************************/
function CMaskDate(opts) {
    var self = this;
    this.container = "";
    this.instance = null;
    this.widget = null;
    var fn_yearRange = function () {
        if (typeof _SYS_GLOBAL != "undefined") {
            var currentYear = parseFloat(_SYS_GLOBAL.DATE.YEAR);
            var year_from = currentYear - 90;
            var year_to = currentYear + 10;
            return year_from + ":" + year_to;
        }
        else {
            return 1900 + ":" + 2020;
        }
    };
    this.options = {
        changeMonth: true,
        changeYear: true,
        yearRange: fn_yearRange(),
        dateTimePicker: false,
        timePicker: false,
        beforeShow: function (e, ints) {
        },
        onClose: function (e, ints) {
        }
    };
    $.extend(true, self.options, opts);
    var fn_ExtendOptions = function () {

        self.options = options;
    };
    this.Init = function (container) {
        self.container = container;
        
        var options = self.options;
        if (options.dateTimePicker == true) {
            self.instance = $(container).datetimepicker(options);
        }
        else if (options.timePicker == true) {
            self.instance = $(container).timepicker(options);
        }
        else {
            self.instance = $(container).datepicker(options);
            $(container).mask("99/99/9999");
        }
    };
}